package com.chen.spike.controller;

import com.chen.spike.mode.RespJson;
import com.chen.spike.model.PostOrder;
import com.chen.spike.service.OrderService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

@Api
@RestController
public class MallController {

    @Autowired
    private OrderService orderService;

    @ApiOperation("提交订单接口")
    @PostMapping(value = "/order")
    public RespJson postOrder(@RequestBody PostOrder postOrder) {

        orderService.createService(postOrder);


        RespJson respJson = new RespJson();
        respJson.setCode("000000");
        respJson.setMsg("success");

        return respJson;
    }

}
